<?php

/**
 * 付费链接控制器
 */
class LinkAction extends HomeAction {

    protected $mod;

    public function _initialize() {
        parent::_initialize();
        $this->mod = M('PayLink');
    }

    /**
     *  付费链接调转
     */
    public function jump() {
        $linkID = format_int($_REQUEST['id']);
        $link   = $this->mod->find($linkID);
        if ($link['end_time'] <= time()) {
            $this->error('链接已过期请续费');
        }
        if ($link['link_status'] != 1) {
            $this->error('链接已关闭或未审核');
        }

        $this->success('正在为你跳转......', $link['url']);
    }

}
